{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <http://www.zhengzhong.net/>

  Created on 2009-04-08.
  $Id$
-->
{% endcomment %}

<div id="contact" class="ajax_box">

  <!-- main _____________________________________________________________________________________-->
  
  <div class="main">
    <span class="h3">Contact:</span>
    {% include "foodsnroses/ajax/ajax_error.html" %}
  </div>
  
  <!-- view _____________________________________________________________________________________-->
  
  <div class="view">
  
    <dl>
      <dt>Website:</dt>
      <dd class="nowrap">
        {% if resto.website %}
          <a href="{{resto.website}}" rel="external">{{resto.website|slice:":28"}}</a>
        {% else %}
          <span class="na">N/A</span>
        {% endif %}
      </dd>
      <dt>Email:</dt>
      <dd class="nowrap">
        {% if resto.email %}
          <a href="mailto:{{resto.email}}">{{resto.email|slice:":28"}}</a>
        {% else %}
          <span class="na">N/A</span>
        {% endif %}
      </dd>
      <dt>Telephone(s):</dt>
      {% if not resto.tel_1 and not resto.tel_2 %}
        <dd class="nowrap"><span class="na">N/A</span></dd>
      {% else %}
        {% if resto.tel_1 %}
          <dd class="nowrap">{{resto.tel_1|escape}}</dd>
        {% endif %}
        {% if resto.tel_2 %}
          <dd class="nowrap">{{resto.tel_2|escape}}</dd>
        {% endif %}
      {% endif %}
    </dl>
    
    {% if resto.is_manageable %}
      <div class="toggle_link">
        <a href="javascript:void(0);" onclick="toggleBox('#contact');">[edit]</a>
      </div>
    {% endif %}
  
  </div><!--/.view-->
  
  <!-- edit _____________________________________________________________________________________-->
  
  {% if resto.is_manageable %}
  
    <div class="edit hidden">
    
      <form id="update_contact_form" class="form" action="." method="POST"
            onsubmit="return submitAjaxForm('#contact', '#update_contact_form');">
        <input type="hidden" name="ajax_box" value="contact"/>
        <dl>
          <dt>Website:</dt>
          <dd class="nowrap">
            <input type="text" name="website" value='{{resto.website|default:"http://"|escape}}'/>
          </dd>
          <dt>Email:</dt>
          <dd class="nowrap">
            <input type="text" name="email" value='{{resto.email|default:""|escape}}'/>
          </dd>
          <dt>Telephone(s):</dt>
          <dd class="nowrap">
            <input type="text" name="tel_1" value='{{resto.tel_1|default:""|escape}}'/>
          </dd>
          <dd class="nowrap">
            <input type="text" name="tel_2" value='{{resto.tel_2|default:""|escape}}'/>
          </dd>
        </dl>
        <div>
          <input class="button" type="submit" value="Update"/>
          <input class="button" type="button" onclick="toggleBox('#contact');" value="Cancel"/>
          <span class="ajax_indicator hidden">
            <img src="{{static_}}/images/ajax_indicator.gif" alt="AJAX Indicator"/>
          </span>
        </div>
      </form>
    
    </div><!--/.edit-->
  
  {% endif %}

</div><!--/#contact-->



